package com.ebupt.migu.music.schedule;

import com.ebupt.migu.music.schedule.service.RosterTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Created by Intellij IDEA.
 * User:  liuyangyang@cd.ebupt.com
 * Date:  2020/4/29
 */
@Slf4j
@Component
@EnableScheduling
public class RosterTask {
    @Autowired
    private RosterTaskService rosterTaskService;

    /**
     * 创建待反查
     */
    @Scheduled(cron = "${cron.roster}")
    public void doRoster() {
        log.info("开始执行创建待反查的名单");
        rosterTaskService.doRoster();
        log.info("完成创建反查");
    }

    /**
     * 追加待反查
     */
    @Scheduled(cron = "${cron.roster}")
    public void doRosterExtend() {
        log.info("开始执行追加待反查的名单");
        rosterTaskService.doRosterExtend();
        log.info("完成名单追加反查");
    }

    /**
     * 每日更新
     */
    @Scheduled(cron = "${cron.roster_daily}")
    public void doDaily() {
        log.info("每日更新名单");
        rosterTaskService.doDaily();
        log.info("每日更新完成");
    }
}
